listview: Implement extending selections
authorBenjamin Otte <otte@redhat.com>
Sun, 6 Oct 2019 02:10:09 +0000 (04:10 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 30 May 2020 23:26:45 +0000 (19:26 -0400)
commitcfcf0a7a8abbf5f0c469f8100d2061935a8d9615
tree11648aa3a504f5ffac56e509c90bc624d4236f26
parentf57fca7a0017b0f9d1225e57f71cb92f8072eabc
listview: Implement extending selections

Shift-clicking to extend selections now also works, imitating the
behavior of normal clicking and Windows Explorer (but not treeview):

1. We track the last selected item (normally, not via extend-clicking).

2. When shift-selecting, we modify the range from the last selected item
   to this item the same way we modify the regular item when not using
   shift:

2a. If Ctrl is not pressed, we select the range and unselect everything
    else.

2b. If Ctrl is pressed, we make the range have the same selection state
    as the last selected item:
    - If the last selected item is selected, select the range.
    - If the last selected item is not selected, unselect the range.
gtk/gtklistview.c